<template>
	<view class="use_List">
		<xbd-pages-content title="可以餐券">
		<template #content>
			<view class="content" :style="'minHeight:'+windowHeight+'px'">
				<view class="box" @click="ordinary">
					<view class="icon">
						<view class="">
							<image src="@/static/images/meal/ordinary.png" mode=""></image>
						</view>
						<text :style="'color:#457AFF '">普通餐券</text>
					</view>
					<view class="box_center">
						<view class="details">
							<view>普通用餐餐券</view>
							<view class="tag"> <text v-if="fromDate.normalCount === 0"> 当前暂无可用餐券</text></view>
						</view>
					</view>
					<view class="right">
						<view class="">
							<image style="width: 48rpx; height: 48rpx;" src="@/static/images/meal/right.png" mode=""></image>
						</view>
					</view>
				</view>
				<view class="box" @click="self">
					<view class="icon">
						<view class="">
							<image src="@/static/images/meal/self.png" mode=""></image>
						</view>
						<text :style="'color:#F4BE2D '">自助餐券</text>
					</view>
					<view class="box_center">
						<view class="details">
							<view>自助餐餐券</view>
							<view class="tag" > <text v-if="fromDate.selfCount === 0">当前暂无可用餐券</text ></view>
						</view>
					</view>
					<view class="right">
						<view class="">
							<image style="width: 48rpx; height: 48rpx;" src="@/static/images/meal/right.png" mode=""></image>
						</view>
					</view>
				</view>
				<view class="box" @click="table">
					<view class="icon">
						<view class="">
							<image src="@/static/images/meal/table.png" mode=""></image>
						</view>
						<text :style="'color: #CA7BFF '">桌餐餐券</text>
					</view>
					<view class="box_center">
						<view class="details">
							<view>桌餐餐券</view>
							<view class="tag"><text v-if="fromDate.tableCount === 0">当前暂无可用餐券</text></view>
						</view>
					</view>
					<view class="right">
						<view class="">
							<image style="width: 48rpx; height: 48rpx;" src="@/static/images/meal/right.png" mode=""></image>
						</view>
					</view>
				</view>
			</view>
		</template>
		</xbd-pages-content>
	</view>
</template>

<script>
	import { mapState } from 'vuex';
	import {
		Meal
	} from '@/api/index.js';
	export default {
		data() {
			return {
				windowHeight:0,
				requer:{
					list_type:'usable',
				},
				fromDate:{
					
				}
			};
		},
		methods: {
			ordinary(){
				uni.navigateTo({
							url:`./usable?type=0`,
						})
			},
			self(){
				uni.navigateTo({
							url:`./usable?type=1`,
						})
			},
			table(){
				uni.navigateTo({
							url:`./usable?type=2`,
						})
			},
			async init() {
				try {
					this.$showLoading('加载中');
					const res = await Meal.getMealList(this.requer);
					uni.hideLoading();
					if(res.success){
						this.fromDate = res.data;
					}else{
						uni.showToast({
								title: res.msg,
								icon: 'none',
							})
					}
				} catch (e) {
					uni.hideLoading();
					console.log(e);
				}
			},
			
		},
		computed: {
		},
		onLoad(){
			this.init()
			uni.getSystemInfo({
				     success:(res) =>{
						 this.windowHeight = res.windowHeight
				         console.log(this.windowHeight);
				     }
				 });
		}
	}
</script>

<style lang="scss" scoped>
	.content{
		.box{
			display: flex;
			justify-content: space-between;
			background-color: #FFFFFF;
			align-items: center;
			box-sizing: border-box;
			padding: 20px 30rpx 10px 30rpx;
			margin-top: 20rpx;
			.box_center{
				flex: 1;
				.details {
					font-size: 36rpx;
					color: #394954;
					.tag {
						width: 200rpx;
						height: 40rpx;
						margin-top: 30rpx;
						font-size: 24rpx;
						color: #999999;
					}
				}
			}
			.icon {
				width: 120rpx;
				box-sizing: border-box;
				text-align: center;
				margin-right: 40rpx;
				
				image {
					width: 88rpx;
					height: 88rpx;
					margin-bottom: 20rpx;
				}
				
				text {
					font-size: 28rpx;
				}
			}
			
		}
	}
</style>
